package umbook.service;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.File;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FileUtils;


public class FileUploadAction  {
    private File userImage;
    private String userImageContentType;
    private String userImageFileName;
 

 
    public void execute() {
        try {
           //String filePath = servletRequest.getSession().getServletContext().getRealPath("/img/users");
            String filePath = "E:\\nb_proyectos\\repository\\canario_grupo3\\CanarioWeb\\web\\img\\users\\";
            //String filePath = "C:\\Users\\el pampa\\Documents\\NetBeansProjects\\canario_grupo3\\CanarioWeb\\web\\img\\users\\";
            System.out.println("Server path:" + filePath);
            File fileToCreate = new File(filePath, this.userImageFileName);
 
            FileUtils.copyFile(this.userImage, fileToCreate);
        } catch (Exception e) {
            e.printStackTrace();
         
        }
  
    }
 
    public File getUserImage() {
        return userImage;
    }
 
    public void setUserImage(File userImage) {
        this.userImage = userImage;
    }
 
    public String getUserImageContentType() {
        return userImageContentType;
    }
 
    public void setUserImageContentType(String userImageContentType) {
        this.userImageContentType = userImageContentType;
    }
 
    public String getUserImageFileName() {
        return userImageFileName;
    }
 
    public void setUserImageFileName(String userImageFileName) {
        this.userImageFileName = userImageFileName;
    }



    

}
